import React, { Component, Fragment } from 'react';

/**
 * 带有权限的组件
 */
class PermissionsWidget extends Component {
  constructor(props) {
    super(props);
    this.state = {
      hiddenMenuButton: localStorage.getItem('cancersystem_menubutton'),
    };
  }

  render() {
    // 读取tag
    const { tag, children } = this.props;
    return <Fragment>{this.state.hiddenMenuButton.indexOf(tag) !== -1 ? null : children}</Fragment>;
  }
}

export default PermissionsWidget;
